﻿#define _CRT_SECURE_NO_WARNINGS 1

#include "SList.h"

void SListTest01()
{
	//创建四个节点
	SLTNode* node1 = (SLTNode*)malloc(sizeof(SLTNode));
	node1->data = 1;

	SLTNode* node2 = (SLTNode*)malloc(sizeof(SLTNode));
	node2->data = 2;

	SLTNode* node3 = (SLTNode*)malloc(sizeof(SLTNode));
	node3->data = 3;

	SLTNode* node4 = (SLTNode*)malloc(sizeof(SLTNode));
	node4->data = 4;

	//将四个节点链接起来
	node1->next = node2;
	node2->next = node3;
	node3->next = node4;
	node4->next = NULL;

	//调用链表打印
	SLTNode* plist = node1;
	SLTPrint(plist);
}

void SListTest02()
{
	SLTNode* plist = NULL;
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);
	SLTPrint(plist);

	SListDesTroy(&plist);

	//SLTNode* find = SLTFind(plist, 4);
	////SLTInsert(&plist, find, 6);
	////SLTErase(&plist, find);
	//SLTEraseAfter(find);
	SLTPrint(plist);


	//if (find == NULL)
	//{
	//	printf("没找到！\n");
	//}
	//else
	//{
	//	printf("找到了！\n");
	//}


	//SLTPushFront(&plist, 6);
	//SLTPushFront(&plist, 7);
	//SLTPushFront(&plist, 8);
	//SLTPrint(plist);

	//SLTPopBack(&plist);
	//SLTPopBack(&plist);
	//SLTPrint(plist);
	//SLTPopFront(&plist);
	//SLTPrint(plist);
	//SLTPopFront(&plist);
	//SLTPrint(plist);
	//SLTPopFront(&plist);
	//SLTPrint(plist);
}


int main()
{
	//SListTest01();
	SListTest02();
	return 0;
}


